package com.cloudcc.mobile.entity;

import java.io.Serializable;


public class RecentItem extends EntityBase implements Comparable<RecentItem>,Serializable{
	private String fromUserId;//发送方用户id
	private String fromUserName;//谁发的
	private String messageType;//1，文本，2语音，3图片
	private String messageId;//取数据通过此属性来取
	private String user_id;//用户id
	private String name;// 消息来自
	private String message;// 消息内容
	private int newNum;// 新消息数目
	private long time;// 消息日期
	public RecentItem() {
	}

	public String getFromUserId() {
		return fromUserId;
	}

	public void setFromUserId(String fromUserId) {
		this.fromUserId = fromUserId;
	}

	public String getFromUserName() {
		return fromUserName;
	}

	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	public String getMessageType() {
		return messageType;
	}

	public void setMessageType(String messageType) {
		this.messageType = messageType;
	}

	public String getMessageId() {
		return messageId;
	}

	public void setMessageId(String messageId) {
		this.messageId = messageId;
	}

	public String getUser_id() {
		return user_id;
	}

	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public int getNewNum() {
		return newNum;
	}

	public void setNewNum(int newNum) {
		this.newNum = newNum;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	public RecentItem(String fromUserId, String fromUserName,
			String messageType, String messageId, String user_id, String name,
			String message, int newNum, long time) {
		super();
		this.fromUserId = fromUserId;
		this.fromUserName = fromUserName;
		this.messageType = messageType;
		this.messageId = messageId;
		this.user_id = user_id;
		this.name = name;
		this.message = message;
		this.newNum = newNum;
		this.time = time;
	}

	@Override
	public int hashCode() {
		int code = 0;
		code = (31 * (this.fromUserId.hashCode())) >> 2;
		return code;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		if (o == null)
			return false;
		if (o == this)
			return true;
		if (o instanceof RecentItem) {
			RecentItem item = (RecentItem) o;
			if (item.fromUserId.equals(this.fromUserId))
				return true;
		}
		return false;
	}

	@Override
	public int compareTo(RecentItem another) {
		// TODO Auto-generated method stub
		return (int) (another.time - this.time);
	}

}
